<?
function isValidDate($date)
{
    $format1 = "Y-m-d";
    $unixTime1 = strtotime($date);
    $checkDate1 = date($format1, $unixTime1);

    $format2 = "Y-n-j";
    $unixTime2 = strtotime($date);
    $checkDate2 = date($format2, $unixTime2);

    $format3 = "Y-m-j";
    $unixTime3 = strtotime($date);
    $checkDate3 = date($format3, $unixTime3);

    $format4 = "Y-n-d";
    $unixTime4 = strtotime($date);
    $checkDate4 = date($format4, $unixTime4);

    if ($checkDate1 == $date || $checkDate2 == $date || $checkDate3 == $date || $checkDate4 ==
        $date)
        return 1;
    else
        return 0;
}
?>